try:
    file = open('book', 'r+')
except Exception as e:
    print('there is no file named as eeeeee')
else:
    response = input('please input end')
#     if response == 'y':
    file = open('book', 'w')  # 开启覆盖写入,不开启追加写入
#     else:
#         pass
    file.write(response)
    file.close()
